<template>
  <custom-drawer
    :title="`${isAdd?'新增':'编辑'}示例`"
    :visible="visible"
    @on-reset="resetForm"
    @on-submit="submitForm"
    @on-open="onShow"
    @on-close="$emit('cancel')"
  >
    <div>表单内容...</div>
  </custom-drawer>
</template>

<script lang="ts" setup>
import CustomDrawer from '@/components/CustomDrawer/index.vue'

const props = defineProps<{ visible: boolean; isAdd: boolean }>()
const emits = defineEmits(['confirm', 'cancel'])

const submitForm = () => {
  // 保存数据...
  onConfirm()
}
const resetForm = () => {
  // 重置数据...
}
const onShow = () => {
  // 打开抽屉事件...
  // eslint-disable-next-line
  console.log(props.isAdd)
}
const onConfirm = () => {
  emits('cancel')
  emits('confirm', 1)
}
</script>
